package com.mybatis;

import com.mybatis.entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class Test02 {

    public static void main(String[] args) {
        //加载spring配置文件
        ApplicationContext ac =
                new ClassPathXmlApplicationContext("spring-mybatis.xml");

        UserServiceI usi = (UserServiceI)ac.getBean("userServiceI");
        User user = new User();
        user.setLoginName("njn123");
        user.setUserName("纳吉尼");
        user.setSex("男");
        Calendar c = Calendar.getInstance();
        user.setCreateDate(c.getTime());
        c.set(1999,05,06);
        user.setBirthday(c.getTime());

        //String result = usi.addUser01(user);
        List<User> list = new ArrayList<User>();
        list.add(user);
        String result = usi.batchAddUser(list);
        System.out.println(result);
    }
}
